<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    class Person {
      constructor(name, age, gender) {
        this.name = name
        this.age = age
        this.gender = gender
      }
      sayHi() {
        console.log('你好啊,我是' + this.name)
      }
    }

    class Student extends Person {
      constructor(name, age, gender, className, score) {
        // this.name = name
        // this.age = age
        // this.gender = gender
        // super()方法本质上就是帮子类对象初始化属性
        // 本质上就是做了 this.name = name / this.age = age的工作
        super(name, age, gender)
        // 帮我赋值(name, age, gender)
        this.className = className
        this.score = score
      }
    }

    // function 帮我赋值(name, age, gender) {
    //   this.name = name
    //   this.age = age
    //   this.gender = gender
    // }

    var p = new Person('刘德华', 18, '男')
    p.sayHi()

    var s = new Student()
    s.sayHi()


    // var o = {}
    // var o1 = new Object()

    // var a = []
    // var arr = new Array()

  </script>
</body>

</html>